﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class AudioView : MonoBehaviour {

    private Toggle toggle;
    private Slider slider;

    private void Awake()
    {
        toggle = transform.Find("Music").GetComponent<Toggle>();
        slider = transform.Find("Volume").GetComponent<Slider>();
        toggle.onValueChanged.AddListener(this.OnToggleSelect);
        slider.onValueChanged.AddListener(this.OnSliderChange);
    }
    public void OnToggleSelect(bool isToggle)
    {
        //if (isToggle)
        //{
        //    SoundManager._Instance.ResumePlayMusic();
        //}
        //else
        //{
        //    SoundManager._Instance.StopPlayMusic();
        //}
        SoundManager._Instance.IsPlay = isToggle;
    }
    public void OnSliderChange(float Value)
    {
        SoundManager._Instance.Volume = Value;
        Debug.Log(Value);
    }
}
